-
Notifications
You must be signed in to change notification settings - Fork 40
Support TiDB #3001
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Support TiDB #3001
Conversation
cabbde3
to
0b82517
Compare
0b82517
to
e87710e
Compare
3e484d7
to
602a8b7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds TiDB support to ScalarDB as an underlying storage by enabling connection through MySQL Connector/J JDBC driver. It supports TiDB versions 6.5, 7.5, and 8.5, with configuration to override the default SERIALIZABLE isolation level to REPEATABLE_READ or READ_COMMITTED since TiDB doesn't support SERIALIZABLE.
- Added isolation level configuration support in JDBC environment setup
- Implemented TiDB-specific handling for unsupported data types in import tests
- Added comprehensive CI integration tests for TiDB versions 6.5, 7.5, and 8.5
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
core/src/integration-test/java/com/scalar/db/storage/jdbc/JdbcEnv.java | Adds isolation level configuration property support for test environment |
core/src/integration-test/java/com/scalar/db/storage/jdbc/JdbcAdminImportTestUtils.java | Implements TiDB detection and specific data type filtering for import tests |
.github/workflows/ci.yaml | Adds CI integration test jobs for TiDB versions 6.5, 7.5, and 8.5 |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
core/src/integration-test/java/com/scalar/db/storage/jdbc/JdbcAdminImportTestUtils.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 👍
@Torch3333 I don’t think we set the SERIALIZABLE isolation level by default. We only set the isolation level when users specify the |
@Torch3333 What would happen if users don't specify BTW, TiDB seems to be linearizable, independent of isolation levels. So, any isolation levels can probaly be fine for correctness. (cc: @brfrn169 ) |
# Conflicts: # .github/workflows/ci.yaml
@brfrn169 @feeblefakie @komamitsu
You are right. I mistakenly thought ScalarDB was setting the JDBC transaction isolation level for all the transaction managers, but in fact, it is only set for the JDBC transaction manager, not for Consensus Commit.
TiDB uses the REPEATABLE-READ as the default level. READ-COMMITED is also an accepted value. Setting SERIALIZABLE will cause the driver to throw this error. The documentation explains it here.
Other than that, I finally found a document listing the features of the MySQL Connector/J driver that TiDB does not support. As far as my understanding goes, I don't think ScalarDB uses any of the incompatibilities, so this confirms that using this driver instead of the TiDB modified version of Connector/J is fine. |
I will put this PR in draft until this blocking dependent PR is merged. |
@komamitsu You raised a point during the demo meeting more than 2 weeks ago about how the driver handles load balancing. There seems to be a library to handle just that, but I will investigate it once other higher-priority tasks are completed. |
Description
This adds support for TiDB versions 6.5, 7.5, and 8.5, a fully MySQL-compliant database. Connection to TiDB is done through the MySQL Connector/J JDBC driver.
TiDB supports the REPEATABLE_READ and READ_COMMITED transaction isolation level. Since the ScalarDB transaction API sets a SERIALIZABLE isolation level by default not supported by TiDB, users must overwrite it by adding
scalar.db.jdbc.isolation_level=REPEATABLE_READ
orscalar.db.jdbc.isolation_level=READ_COMMITED
to their configuration to use ScalarDB transactional API interfaces.A sample ScalarDB configuration to use TiDB is as follows.
Related issues and/or PRs
N/A
Changes made
Checklist
Additional notes (optional)
N/A
Release notes
TiDB versions 6.5, 7.5, and 8.5 are now supported as underlying storage by using MySQL Connector/J JDBC driver.